<template>
	<div class="person">
		<h2>人员信息</h2>
		<h3>姓名：{{name}}</h3>
		<h3>年龄：{{age}}</h3>
		<h3>性别：{{gender}}</h3>
		<h3>爱好：{{hobby}}</h3>
		<h3>座驾：{{cars}}</h3>
		<button @click="age+=1">修改我收到的年龄</button>
		<button @click="gender = '女'">修改我收到的性别</button>
		<button @click="changeFirstHobby">修改我收到的第一个爱好</button>
		<button @click="changeFirstCar">修改我收到的第一个车</button>
	</div>
</template>

<script>
	export default {
		name:'Person',
		data() {
			return {
				name:'李四'
			}
		},
		props:['name','age','gender','hobby','cars'],
		methods: {
			changeFirstHobby(){
				this.hobby.splice(0,1,'学习')
			},
			changeFirstCar(){
				this.cars.c1 = '玛莎拉蒂'
			}
		},
		mounted() {
			console.log('Person的vc',this)
		},
	}
</script>

<style>
	.person{
		background-color: skyblue;
		padding: 20px;
	}
</style>